<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="crm.model.Bargain"%>
<%@page import="crm.control.BargainControl"%>
<%@page import="crm.model.Offer"%>
<%@page import="crm.control.OfferControl"%>
<%@page import="crm.control.EmployeesControl"%>
<%@page import="crm.control.RecepitControl"%>
<%@page import="crm.model.Employees"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../resources/css/inner.css" type="text/css" media="screen" />
<link href="../../../resources/validation/css/formitem.css" rel="stylesheet" type="text/css" />
<style type="text/css">
html{overflow-y:scroll}
</style>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>查看合同详情</title>
		<script type="text/javascript"
		src="../../../resources/js/jquery-1.6.2.min.js"></script>
	<script type="text/javascript">
	$(function(){
           $('#show_add_money').hide();
           $('#add_money').click(function(){
    				$('#show_add_money').slideToggle();
               })
               $('#cancel').click(function(){
 						$('#show_add_money').fadeOut();
                   })
                   $('input:text').click(function(){
				return false;
				})

		})
	
	</script>
	</head>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
			int bargainId = Integer.parseInt(request.getParameter("id"));
			Bargain bargain = new Bargain();
			bargain = BargainControl.getBargainById(bargainId);
			Offer offer = new Offer();
			int offer_id = bargain.getOffer_id();
			offer = OfferControl.getOfferById(offer_id);
			Employees cu = (Employees)session.getAttribute("user");
		%>
			<table>
			    <tr>
			        <td>
			                              合同编号
			        </td>
			        <td>
			            <%
			                out.print(bargain.getBargain_id());
			             %>
			        </td>
			    </tr>
				<tr>
					<td>
						合同名称
					</td>
					<td>
						<%
							out.print(bargain.getTitle());
						%>
					</td>
				</tr>
				<tr>
				<td>
				当前跟单人
				</td>
				<td>
				<%=EmployeesControl.getEmployeesName((RecepitControl.getRecepitById((OfferControl.getOfferById(BargainControl.getBargainById(bargainId).getOffer_id())).getRecepit_id()).getCurrent_person())) %>
				</td>
				</tr>
				<%
            String p[] = RecepitControl.getRecepitById(offer.getRecepit_id()).getPrduct().split("@");
       %>
       <tr>
					<td>
						成交金额
					</td>
					<td>
						<%
							out.print(bargain.getDeal_money());
						%>
					</td>
				</tr>
				<tr>
					<td>
						总共回款金额
					</td>
					<td>
						<%
							out.print(bargain.getReturned_money());
						%>
					</td>
				</tr>
				<tr>
					<td>
						最迟回款时间
					</td>
					<td>
						<%
							out.print(bargain.getLatest_date());
						%>
					</td>
				</tr>
				<tr>
					<td>
						是否超期
					</td>
					<td>
						<%
							if (bargain.getIs_overdue().equals("1"))
								out.print("是");
							else
								out.print("否");
						%>
					</td>
				</tr>
				<tr>
					<td>
						PDF文件地址
					</td>
					<td>
					<%
					  if(bargain.getPdf()==null||bargain.getPdf().equals("")){
						  out.print("没有相关文件");
					  }else{
					%>
					<a href="../../../resources/resources/<%=bargain.getPdf() %>">预览文件</a>
					<a href="download.jsp?file=<%=bargain.getPdf() %>">点击下载</a>
					<%} %>
					</td>
				</tr>
       </table>
       <p class='center'>产品</p>
       <table>
       <tr><td>天成软件</td><td><%=p[1] %></td> </tr>
       <tr><td>第三方软件</td><td><%=p[2] %></td> </tr>
       <tr><td>相关硬件</td><td><%=p[3] %></td> </tr>
				
				<%
				if(bargain.getIs_overdue()!=null&& bargain.getIs_overdue().equals("1")){
				 %>
				<%} %>
			</table>
		</fieldset>
		<%//if(cu.getId()==RecepitControl.getRecepitById(offer.getRecepit_id()).getCurrent_person()){ %>
		<p class='center'><input type="button" class='button' value="添加回款金额" id="add_money" /></p>	
		<div id="show_add_money"  >
                     <form id="form1" name="form1" method="post" action="add_returned_money.jsp?id=<%=bargainId%>">
                      	输入金额
                      <input  type="text" style="width:190px;" name="add_money"  />
                      <select name="danwei"><option value="0">元</option><option value="1">万元</option></select>
                      <br />确认金额
                       <input  type="text" style="width:190px;" name="add_money2"  />
                      <select name="danwei2"><option value="0">元</option><option value="1">万元</option></select>
                      <br />
                      <p class='center'><input  type="submit" class='button' class="btn_tag" value="确定" />&nbsp;&nbsp;&nbsp;&nbsp;
                       <input  type="button" class='button'  id="cancel"  value="取消" />
                       </p>
                    </form>
</div>
<%//} %>
	</body>
</html>